from media.lib.views import FileUploadFormMixin
from .lib import (
    HTMXProjectSubCreateFormView,
    HTMXProjectSubUpdateFormView,
    ProjectSubAuditDetailView,
    ProjectSubAuditFormPostAPIView,
    ProjectSubListView,
    template_path,
)

from .. import forms, models

class PlanListView(ProjectSubListView):
    template_name = template_path("plan/list.html")

class PlanCreateView(
    FileUploadFormMixin,
    HTMXProjectSubCreateFormView
):
    form_class = forms.PlanForm
    create_view_name = "project:plan/create"
    detail_view_name = "project:plan/detail"

class PlanDetailView(ProjectSubAuditDetailView):
    model = models.Plan
    form_class = forms.PlanForm
    template_name = template_path("plan/detail.html")
    audit_permission = "user.can_manage_projects"
    audit_viewname = "project:plan/audit"


class PlanUpdateView(
    FileUploadFormMixin,
    HTMXProjectSubUpdateFormView
):
    model = models.Plan
    form_class = forms.PlanForm
    update_view_name = "project:plan/update"
    detail_view_name = "project:plan/detail"


class PlanAuditFormPostAPIView(ProjectSubAuditFormPostAPIView):
    model = models.Plan
    
    
